package com.spring.boot.mvc.service.impl;

import com.spring.boot.mvc.service.IRedisService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service(value = "redisService")
public class RedisServiceImpl implements IRedisService {

    private static final Logger logger = LoggerFactory.getLogger(RedisServiceImpl.class);

    @Resource
    private RedisTemplate<String, String> redisTemplate;

    @Override
    public String getRedisValue(String key) {
        logger.info("获取数据:key={}", key);
        return redisTemplate.opsForValue().get(key);
    }
}